package com.itheima.controller;

import com.itheima.domain.Student;
import com.itheima.service.StudentService;

import java.util.Scanner;

public class StudentController extends Base1StudentController{
    private Scanner sc = new Scanner(System.in);
    //键盘录入学生姓名,年龄,生日的方法
    public Student getStudent(String sid) {
        String name = null;
        while (true) {
            System.out.println("请输入学生的姓名:");
            name = sc.nextLine();
            if (name.equals("")) {
                System.out.println("姓名不能为空,请重新输入!");
            } else {
                break;
            }
        }
        String age = null;
        while (true) {
            System.out.println("请输入学生的年龄:");
            age = sc.nextLine();
            if (age.equals("")) {
                System.out.println("年龄不能为空,请重新输入!");
            } else {
                break;
            }
        }
        String birthday = null;
        while (true) {
            System.out.println("请输入学生的生日:");
            birthday = sc.nextLine();
            if (birthday.equals("")) {
                System.out.println("生日不能为空,请重新输入!");
            } else {
                break;
            }
        }
        return new Student(sid, name, age, birthday);
    }
}
